//
//  APIMessageManager.m
//  cocoapodText
//
//  Created by apple on 16/10/18.
//  Copyright © 2016年 apple. All rights reserved.
//


#import "NetTool.h"
#import "AFNetworking.h"
#import "APIMessageManager.h"

@interface APIMessageManager()

@end
@implementation APIMessageManager
/**
 *@name 消息订阅
 *@param msuId=1 备注：3=定额下达, 2=指标预警, 1=定额预警, 6=可调企业基础数据下达, 5=能源调度下达, 4=指标下达
 *@param year=201608
 *@param pageNum   第几页
 *@param recoredCount  总共的记录数
 *@param pageRecord  每页记录数
 */
- (void)fsgy_api_info_message_subscribe_withFalg:(NSString *)falg MsuId:(NSString *)msuId Issub:(NSString *)issub Year:(NSString *)year PageNum:(NSString *)pageNum RecoredCount:(NSString *)recoredCount PageRecord:(NSString *)pageRecord{
    AFHTTPSessionManager *session = [AFHTTPSessionManager manager];
    //申明返回的结果是json类型
    session.responseSerializer = [AFJSONResponseSerializer serializer];
    //如果报接受类型不一致请替换一致text/html或别的
    session.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/plain"];
    NSString *neturl=[NetTool fsgy_info_message_subscribe];
    NSDictionary *params=@{@"action":@"searchTable",@"msuId":msuId,@"issub":issub,@"year":year,@"pageNum":pageNum,@"recoredCount":recoredCount,@"pageRecord":pageRecord};
    [session GET:neturl parameters:params success:^(NSURLSessionDataTask *task, id responseObject) {
        if([_delegate respondsToSelector:@selector(onMessageManager:result:Flag:)]){
            [_delegate onMessageManager:self result:responseObject Flag:falg];
        }
    } failure:^(NSURLSessionDataTask *task, NSError *error) {
        [CommonTool isSessionExpired:task];
    }];
}


@end
